package com.infowarelab.compare;

import java.util.List;
import java.util.ArrayList;

class JavaCode {
	private List filterLongerThan(List strings, int length) {
		List result = new ArrayList();
		for (int i = 0; i < strings.size(); i++) {
			String s = (String) strings.get(i);
			if (s.length() <= length) {
				result.add(s);
			}
		}
		return result;
	}

	public static void main(String[] args) {
		List names = new ArrayList();
		names.add("Ted");
		names.add("Fred");
		names.add("Jed");
		names.add("Ned");
		System.out.println(names);
		JavaCode e = new JavaCode();
		List shortNames = e.filterLongerThan(names, 3);
		System.out.println(shortNames.size());
		for (int i = 0; i < shortNames.size(); i++) {
			String s = (String) shortNames.get(i);
			System.out.println(s);
		}
	}
}